import { ProFormOptions, FormItemProps } from '@/components/pro-form/type'
import { GridItemProps } from 'naive-ui'
import { {{ bigName }}Model } from '@/api/model/{{ fileName }}-model'

export const use{{ bigName }}ProForm = () => {
  const [{{ smallName }}Form, reset{{ bigName }}Form] = useProRef<Partial<{{ bigName }}Model>>({})
  const {{ smallName }}FormOptions = computed<ProFormOptions>(() => {
    const list = [
      {
        formType: 'input',
        key: 'budgetName',
        label: '预算名称',
        placeholder: '请输入预算名称'
      },
      {
        formType: 'date',
        key: 'receiveDate',
        label: '申请日期',
        placeholder: '请选择申请日期'
      },
      {
        formType: 'inputNumber',
        key: 'budgetAmount',
        label: '预算金额',
        placeholder: '请输入预算金额'
      },
      {
        formType: 'textarea',
        key: 'remark',
        label: '备注',
        gridItem: {
          span: 2
        },
        placeholder: '请输入备注',
        noRule: true
      }
    ] as (FormItemProps & {
      gridItem?: GridItemProps
      noRule?: boolean
      ruleType?: string
    })[]
    return useSetOptions(list)
  })

  return {
    {{ smallName }}Form,
    {{ smallName }}FormOptions,
    reset{{ bigName }}Form
  }
}
